package com.kedacom.demo.modularity.feed;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "feed")
public class Feed {

	protected static SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

	private Long id;
	private String body;
	private String createdBy;
	private Date createdAt;

	public Feed() {
	}

	public Feed(Long id, String body, String createdBy) {
		this.id = id;
		this.body = body;
		this.createdBy = createdBy;
		this.createdAt = Calendar.getInstance().getTime();
	}

	public String toString() {
		return String.format("{id=%s,body=%s,createdBy=%s,createdAt=%s}", id, body, createdBy,
				formatter.format(createdAt));
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getBody() {
		return body;
	}

	public void setBody(String body) {
		this.body = body;
	}

	public String getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(String createdBy) {
		this.createdBy = createdBy;
	}

	public Date getCreatedAt() {
		return createdAt;
	}

	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}

}
